package com.lhy.framework.test.bean;

import com.lhy.framework.beans.BeansException;
import com.lhy.framework.beans.factory.BeanClassLoaderAware;
import com.lhy.framework.beans.factory.BeanFactory;
import com.lhy.framework.beans.factory.BeanFactoryAware;
import com.lhy.framework.beans.factory.BeanNameAware;
import com.lhy.framework.context.ApplicationContext;
import com.lhy.framework.context.ApplicationContextAware;

/**
 * @ClassName UserService
 * @Description
 * @Author lihaiyang
 * @Date 2022/9/8 22:01
 * @Version 1.0
 */
public class UserService implements BeanNameAware, BeanClassLoaderAware, ApplicationContextAware, BeanFactoryAware {

    private ApplicationContext applicationContext;

    private BeanFactory beanFactory;

    private String userId;

    private String company;

    private String location;

    private UserDao userDao;

    public UserService() {
    }


    public void queryUserInfo() {
        System.out.println("查询用户信息：" + userDao.queryUserName(userId) + " " + company + " " + location);
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }


    @Override
    public void setBeanClassLoader(ClassLoader classLoader) throws BeansException {
        System.out.println("ClassLoader:" + classLoader);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    @Override
    public void setBeanName(String name) throws BeansException {
        System.out.println("BeanName:" + name);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    public ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public BeanFactory getBeanFactory() {
        return beanFactory;
    }
}
